import type { ModelTypeRow } from '#/views/onlineDesign/designModel/designModel.data';

import { requestClient } from '#/api/request';

export namespace GenModelClassifyTableApi {
  export type RowTypeFetchParams = ModelTypeRow;
  export interface IdFetchParams {
    id: string;
  }
  export interface SearchFetchParams {
    searchContent: string;
  }
  export interface ListFetchParams {
    [key: string]: any;
  }
  export interface PageListFetchParams {
    [key: string]: any;
    pageNo: number;
    pageSize: number;
  }
}

/**
 * 分页列表查询
 */
export async function onlineModelClassifyQueryPageListApi(
  params: GenModelClassifyTableApi.PageListFetchParams,
) {
  return requestClient.get('/gen/modelClassify/queryPageList', {
    params,
  });
}

/**
 * 列表查询
 */
export async function genModelClassifyQueryListApi(
  params: GenModelClassifyTableApi.ListFetchParams,
) {
  return requestClient.get('/gen/modelClassify/queryList', { params });
}

/**
 * 通过ID查询
 * @param params
 */
export async function genModelClassifyQueryByIdApi(
  params: GenModelClassifyTableApi.IdFetchParams,
) {
  return requestClient.get('/gen/modelClassify/queryById', { params });
}

/**
 * 新增
 */
export async function genModelClassifyAddApi(
  params: GenModelClassifyTableApi.RowTypeFetchParams,
) {
  return requestClient.post('/gen/modelClassify/add', params);
}

/**
 * 编辑
 */
export async function genModelClassifyEditApi(
  params: GenModelClassifyTableApi.RowTypeFetchParams,
) {
  return requestClient.post('/gen/modelClassify/edit', params);
}

/**
 * 删除
 * @param id 主键
 */
export async function genModelClassifyDelApi(id) {
  return requestClient.delete<boolean>(`/gen/modelClassify/delete/${id}`);
}

/**
 * 批量删除删除
 * @param ids 主键
 */
export async function onlineModelClassifyDeleteBatchApi(ids) {
  return requestClient.delete<boolean>(
    `/gen/modelClassify/deleteBatchByIds/${ids}`,
  );
}

/**
 * 获取模型分类和模型
 * @param params 模型名称或编码
 */
export async function genModelClassifyQueryClassifyAndModelApi(
  params: GenModelClassifyTableApi.SearchFetchParams,
) {
  return requestClient.get('/gen/modelClassify/queryClassifyAndModel', {
    params,
  });
}
